﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AreaSelect.aspx.cs" Inherits="WebApplication.Admin.AreaSelect" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>部门选择</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <script src="../../scripts/boot.js" type="text/javascript"></script>
    <style type="text/css">
        .mini-summary-row
        {
            background-color: #FFFFE6;
        }
        html, body
        {
            margin: 0;
            padding: 0;
            border: 0;
            width: 100%;
            height: 100%;
            overflow: hidden;
        }
    </style>
</head>
<body>
    <div style="width: 100%;" runat="server" id="operationPanel">
        <div class="mini-toolbar" style="border-bottom: 0; padding: 0px;">
            <table style="width: 100%;">
                <tr>
                    <td style="white-space: nowrap;">
                        <input id="key" class="mini-textbox" emptytext="输入名称进行查询" style="width: 280px;" onenter="onKeyEnter" />
                        <a class="mini-button" iconcls="icon-search" onclick="search()">查询</a>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div class="mini-fit">
        <div id="datagrid1" class="mini-datagrid" style="width: 100%; height: 100%;" allowresize="true"
            pagesize="20" allowcellselect="true" multiselect="true" allowcellvalid="true"
            editnextonenterkey="true" editnextrowcell="true" url="/Handler.ashx?method=LoadArea"
            idfield="Account" onrowdblclick="onRowDblClick" emptytext="数据为空!" showemptytext="true">
            <div property="columns">
                <div type="indexcolumn" headeralign="center" allowsort="true">
                    序号</div>
                <div type="checkcolumn">
                </div>
                <div field="Name" width="500" allowsort="true" vtype="required;maxLength:50">
                    名称
                    <input property="editor" class="mini-textbox" style="width: 100%;" />
                </div>
            </div>
        </div>
    </div>
    <div class="mini-toolbar" style="text-align: center; padding-top: 8px; padding-bottom: 8px;"
        borderstyle="border:0;">
        <a class="mini-button" style="width: 60px;" onclick="onOk()">确定</a> <span style="display: inline-block;
            width: 25px;"></span><a class="mini-button" style="width: 60px;" onclick="onCancel()">
                取消</a>
    </div>
    <script type="text/javascript">
        mini.parse();
        var grid = mini.get("datagrid1");
        grid.load();

        function search() {
            var key = mini.get("key").getValue();

            grid.load({ key: key });
        }

        function onKeyEnter(e) {
            search();
        }

        function onRowDblClick(e) {
            onOk();
        }

        var singleMode = <%=SingleMode %>;
        grid.setMultiSelect(!singleMode);
        function SetData(data) {
            data = mini.clone(data);
            if (data.singleMode) { singleMode = true; } else { singleMode = false; }
            grid.setMultiSelect(!singleMode);
        }

        function GetData() {
            if (singleMode) { return grid.getSelected(); }
            return grid.getSelecteds();
        }

        function CloseWindow(action) {
            if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
            else window.close();
        }

        function onOk() {
            CloseWindow("ok");
        }
        function onCancel() {
            CloseWindow("cancel");
        }
    </script>
</body>
</html>
